
#include "IsoVortexProblem.h"

template<>
InputParameters validParams<IsoVortexProblem>()
{
  InputParameters params = validParams<EulerProblem>();

  return params;
}

IsoVortexProblem::IsoVortexProblem(const InputParameters &params) :
	EulerProblem(params),
	_vel(1,1,0)
{
}

void IsoVortexProblem::valueExact(Real* value, Real t, const Point& p)
{
	Real x = p(0)-_vel(0)*t;
	Real y = p(1)-_vel(1)*t;
	Real z = p(2)-_vel(2)*t;
	Real gam=1.4, gamm1=gam-1, epi=5.;
	Real xb, yb, r2;

	Real PI = libMesh::pi;
	xb = x+5;
	yb = y+5;
	r2=xb*xb+yb*yb;

	Real u = _vel(0)+epi/( 2.*PI ) * exp( 0.5 * ( 1.-r2 ) ) * (-yb );
	Real v = _vel(1)+epi/( 2.*PI ) * exp( 0.5 * ( 1.-r2 ) ) * xb;
	Real T = 1. - gamm1*epi*epi/( 8*gam*PI*PI ) * exp( 1.-r2 );
	Real density = pow( T, 1/gamm1 );
	Real pre=pow(density, gam);

	value[0] = density;
	value[1] = density*u;
	value[2] = density*v;
	value[3] = density*0;
	value[4] = pre/gamm1+0.5*density*(u*u+v*v);
}
void IsoVortexProblem::initialCondition(Real* value, Real t, const Point& p)
{
	valueExact(value, t, p);
}
